package com.wangp.qms.dbcenter;

import java.util.concurrent.ConcurrentHashMap;

import com.wangp.qms.entity.User;

/**
 * 模拟数据库，所有的排队队列信息，都保存在此
 * 
 * @author wangp
 * 
 */
public class DBCenter {

	// VIP客户存储
	private static ConcurrentHashMap<Integer, User> vipDBCenter;
	// 优先客户存储
	private static ConcurrentHashMap<Integer, User> priorDBCenter;
	// 普通客户存储
	private static ConcurrentHashMap<Integer, User> generalDBCenter;

	// 系统启动，初始化数据库
	static {
		vipDBCenter = new ConcurrentHashMap<Integer, User>();
		priorDBCenter = new ConcurrentHashMap<Integer, User>();
		generalDBCenter = new ConcurrentHashMap<Integer, User>();
	}

	// 加入Vip队列
	public static void putVIP(Integer num, User user) {
		vipDBCenter.put(num, user);
	}

	// 加入Prior队列
	public static void putPrior(Integer num, User user) {
		priorDBCenter.put(num, user);
	}

	// 加入General队列
	public static void putGeneral(Integer num, User user) {
		generalDBCenter.put(num, user);
	}

	// 取出Vip队列
	public static User getVIP(Integer num) {
		return vipDBCenter.get(num);
	}

	// 取出Prior队列
	public static User getPrior(Integer num) {
		return priorDBCenter.get(num);
	}

	// 取出General队列
	public static User getGeneral(Integer num) {
		return generalDBCenter.get(num);
	}

}